<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>合成与影子 DOM 槽位</title>
</head>
<body>
  <div id="foo">
    <p>Foo</p>
  </div>
  <script>
    setTimeout(() => {
      const shadowDOM = document.querySelector('div').attachShadow({ mode: 'open' });
      // 实际上只是 DOM 内容的投射(projection)
      shadowDOM.innerHTML = `
        <div #id="bar">
          <slot></slot>
        </div>
      `;
    }, 1000);
  </script>
</body>
</html>